<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="78px">
      <el-form-item label="用户名称" prop="userName">
        <el-input
            v-model="queryParams.userName"
            placeholder="请输入用户名称"
            clearable
            style="width: 240px"
            @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="线路标识" prop="lineId">
        <el-select v-model="queryParams.lineId" placeholder="请选择线路标识" clearable>
          <el-option
              v-for="dict in line_info"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
            type="primary"
            plain
            icon="Plus"
            @click="handleAdd"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
            type="success"
            plain
            icon="Edit"
            :disabled="single"
            @click="handleUpdate"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
            type="danger"
            plain
            icon="Delete"
            :disabled="multiple"
            @click="handleDelete"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
            type="warning"
            plain
            icon="Download"
            @click="handleExport"
        >导出</el-button>
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="userLineList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="流水号" align="center" prop="id" v-if="false"/>
      <el-table-column label="用户名称" align="center" key="userName" prop="userName"  :show-overflow-tooltip="true" />
      <el-table-column label="用户名称" align="center" key="userName" prop="userName"  :show-overflow-tooltip="true" />
<!--      <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName"  :show-overflow-tooltip="true" />-->
      <el-table-column label="线路标识" align="center" prop="lineId" />
      <el-table-column label="线路名称" align="center" prop="lineName" />
    </el-table>

    <el-dialog :title="title" v-model="open" width="600px" append-to-body>
      <el-form ref="lineInfoRef" :model="form" :rules="rules" label-width="120px">

      </el-form>
    </el-dialog>
  </div>
</template>

<script setup name="UserLine">

const { proxy } = getCurrentInstance();
const { host_info, line_info, valid } = proxy.useDict('host_info', 'line_info', 'valid');
const showSearch = ref(true);
const loading = ref(true);
const title = ref("");
const open = ref(false);
const single = ref(true);
const multiple = ref(true);

const userLineList = ref([])

const form = ref({})
const rules = ref({

})
const queryParams = ref({
  userName: null,
  lineId: null
})


function getList(){

  loading.value = false;
}

function handleQuery(){

}
function resetQuery(){

}
function  handleSelectionChange(){

}

function handleAdd(){
  reset()
  open.value = true;
  title.value = "添加用户和线路关系";
}

function handleUpdate(){

}

function handleDelete(){

}

function handleExport(){

}

// 表单重置
function reset() {
  form.value = {

  }
  // proxy.resetForm("fiberInfoRef");
}
getList()
</script>

<style scoped>

</style>